<template>
  <div class="container">
    <div class="app-container">
      <div class="left">
        <!-- 树形组件 -->
        <el-tree
          icon-class="el-icon-folder-add"
          :data="depts"
          :props="defaultProps"
          :default-expand-all="false"
          :expand-on-click-node="false"
          style="width: 180px; text-align: center"
          @node-click="hClick"
        />
      </div>
      <!-- 右侧结构树对应的内容 -->
      <div class="log-list-right">
        <div slot="header" class="clearfix">
          <label class="diqu">地区关键词：
            <el-input class="el" placeholder="请输入内容" />
          </label>

        </div>
        <!-- 地图 -->
        <div class="demo-image__placeholder">

          <div class="block">

            <el-image :src="src">
              <div slot="placeholder" class="image-slot">
                加载中<span class="dot">...</span>
              </div>
            </el-image>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { gettree } from '@/api/bench'
export default {
  data() {
    return {
      // 组织数据
      depts: [{
        name: '一级 1',
        children: [{
          id: 5,
          name: '二级 1-1'
        }]
      },
      {
        name: '一级 1',
        children: [{
          id: 5,
          name: '二级 1-1'
        }]
      }],
      defaultProps: {
        label: 'name',
        children: 'children'
      },
      src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg'
    }
  },
  created() {
    this.upTree()
  },
  methods: {
    hClick() {
      console.log(1)
    },
    async upTree() {
      const res = await gettree()
      const jsonString = JSON.parse(res.data)
      this.depts = jsonString
    }
  }
}
</script>

<style lang="scss" scoped>
.app-container {
  background: #fff;
  display: flex;
  .left {
    width: 280px;
    padding: 20px;
    border-right: 1px solid #eaeef4;

  }

  .right {
    flex: 1;
    padding: 20px;
    .opeate-tools {
      margin:10px ;
    }
    .username {
      height: 30px;
      width: 30px;
      line-height: 30px;
      text-align: center;
      border-radius: 50%;
      color: #fff;
      background: #04C9BE;
      font-size: 12px;
      display:inline-block;
    }
  }
  .clearfix{
    display: flex;
    height: 50px;
    line-height: 50px;
    margin-top: 20px;

    .diqu{
    color: #20232a;
    font-weight: 400;
    font-size: 14px;
    width: 100%;
    margin-left: 30px;
    }
    .el{
    background-color: #fff;
    background-image: none;
    border-radius: 4px;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 50px;
    line-height: 50px;
    outline: 0;

    transition: border-color .2s cubic-bezier(.645,.045,.355,1);
    width: 180px;
    }

  }
  .block{
    padding: 30px;
}
}
 #spanstyle{
      color: #20232a;
      font-weight: 400;
      font-size: 14px;
      font-family: PingFangSC, PingFangSC-Regular;
      margin-right: 14px;
      line-height: 40px;
  }

</style>

